
<link rel="stylesheet" href="/assets/style/css/css.css">
<link rel="stylesheet" href="/assets/style/css/rili.css">
<link rel="stylesheet" href="/assets/style/css/layui.css">
<script src="/assets/style/js/jquery.js"></script>

<script src="/assets/style/js/layer-v3.0.1/layer/layer.js"></script>
<script src="/assets/My97DatePicker/WdatePicker.js"></script>

<style>

    .btn1{
        width: 150px;
        height: 50px;
        line-height: 50px;
        text-align: center;
        background: #ff5500;
        color: #fff;
        font-size: 22px;
        position: absolute;
        right: 17px;
        top: 17px;
        cursor: pointer;

    }

    </style>


<div class="showbgdiv">
    <div class="mt20 main1200 orderinfo fix">
        <div class="info_left">
            <div class="pay_xianxia">
                <div class="pay_title">{$productinfo['p_name']}</div>
                <div class="pay_tt">
                    <p>{$productinfo['s_name']}</p>
                    <p class="num">产品编号：{$productinfo['id']}</p>
                    <div class="ptit">大于2周岁不满12周岁的儿童不可使用出生证明，请使用身份证、户口簿等，乘机请携带填写的相应证件。</div>
                </div>

                <input type="hidden" id="npnum" value="{$order.p_num}">
                {volist name="order['orderinfo']" id="odinfo" key="i"}
                <ul class="pay_resuit">
                    <li><span>出发城市</span>{$odinfo['packageinfo']['startcity']}</li>
                    <li><span>返回城市</span>{$odinfo['packageinfo']['endcity']}</li>
                    <li><span>出发日期</span>{$odinfo['starttime']}</li>
                    <li><span>结束日期</span>{$odinfo['endtime']}</li>
                    <li class="noflot"><span>出行人数</span>{$odinfo['tournum']}人</li>
                    <li class="noflot"><span>交通方式</span>{$productinfo['transport']}</li>


                </ul>
                {/volist}
            </div>

            <!--自费项目

                var inarray=new Array();
            inarray['id'] = $(obj).attr("thisid");
            inarray['sppid']=$(obj).attr("thissppid");
            inarray['sppackageid']=$(obj).attr("thisspp_packageid");
            inarray['title'] = $(obj).attr("thistitle");
            inarray['uprice'] = $(obj).attr("thisprice");
            inarray['cprice'] = $(obj).attr("thiscprice");
            inarray['unum'] = npnum;
            inarray['cnum'] = 0;
            inarray['ctotal'] = $(obj).attr("thisprice") * npnum;
            sed[sed.length]=inarray;
            -->


            <div id="supplement">

            {volist name="supplement_list" id="supplement" key="i"}

            <p thisid="{$supplement['spitem_id']}" thissppid="{$supplement['pro_id']}" thisspp_packageid="{$supplement['package_id']}" thistitle="{$supplement['title']}" thisprice="{$supplement['unitprice']}" thiscprice="" thisnpnum="{$supplement['num']}" thiscnum="" thisctotal=""> {$supplement['title']}</p><br/>
            {/volist}
            </div>
            {if isset($selfpayinfo['spitem'])}

            <div class="mt20 pbcont">
                <div class="pb_intit">自费项目</div>

                <ul class="zfxmli">

                    {volist name="selfpayinfo['spitem']" id="spitem" key="i"}
                    <li>
                        <div class="xm_day">{$spitem['title']}</div>

                        {volist name="spitem['spgroup']" id="spgroup" key="i"}
                        {volist name="spgroup['sp']" id="sp" key="i"}

                        {volist name="sp['spprice']" id="spprice" key="i"}
                        <dl class="xm_list">
                            <dt class="fix" id="1">
                                <div class="xm_tit" stype={$spgroup.selecttype} thisid="{$sp.id}" thistitle="{$sp.title}" thisprice="{$spprice.price}" thiscprice="{$spprice.childrenprice}" thissppid="{$sp.spp_id}" thisspp_packageid="{$sp.sppackageid}" onclick="cselect{$spgroup.selecttype}(this)">

                                    {if condition="$spgroup['selecttype'] eq 1"}
                                    <em class="" thisid="<?php echo $sp['id']; ?>" fno="<?php echo $spgroup['id']?>"></em>
                                    {/if}
                                    {if condition="$spgroup['selecttype'] eq 2"}
                                    <span thisid="<?php echo $sp['id']; ?>" fno="<?php echo $spgroup['id']?>"></span>
                                    {/if}

                                    <i class="bt"> {$sp['title']}{$spprice['title']}</i>
                                </div>
                                <div class="xmbox right">
                                    <ul class="buynun fix">

                                        {if isset($spprice['childrenprice'])}
                                        <li class="et"><em>儿童</em><b>€<i>3380</i></b>
                                            <span class="reduc" onclick="cpminus(this)" thisid="{$sp.id}" thispirce="{$spprice.childrenprice}" thisfno="{$spgroup.id}" thistype="{$spgroup.selecttype}">-</span>
                                            <input type="text" value="0" />
                                            <span class="add" onclick="cpadd(this)" thisid="{$sp.id}" thispirce="{$spprice.childprice}" thisfno="{$spgroup.id}" thistype="{$spgroup.selecttype}">+</span>
                                        </li>

                                        {/if}
                                        <li class="cr"><em>单价</em><b>€<i>{$spprice['price']}</i></b>
                                            <span class="reduc" onclick="upminus(this)" thisid="{$sp.id}" thispirce="{$spprice.price}" thisfno="{$spgroup.id}" thistype="{$spgroup.selecttype}">-</span>
                                            <input type="text" value="0" size="4" id="up{$sp.id}"/>
                                            <span class="add" onclick="upadd(this)" thisid="{$sp.id}" thispirce="{$spprice.price}" thisfno="{$spgroup.id}" thistype="{$spgroup.selecttype}">+</span>
                                        </li>
                                    </ul>
                                </div>
                            </dt>
                        </dl>

                        {/volist}
                        {/volist}
                        {/volist}
                    </li>
                    {/volist}
                </ul>
            </div>
            {/if}













            <div class="pay_bot">
                <div class="pay_sum"><em>合计</em><span>€</span><span id="tatol_b"> {$order['payprice']}</span></div>
                <div class="pay_btn" style="display: block">提交订单</div>
                <div class="btn1" id="pay_btn">提交订单</div>
            </div>
        </div>

        <div class="info_right">
            <div class="pay_r_t">{$productinfo['p_name']}</div>
            <ul class="inlist">
                <li><span class="left">基本团费</span><em class="right">€ <i id="t_totlaprice">{$discount_baseprice_total}</i></em></li>

                {volist name="order['orderinfo']" id="odinfo" key="i"}
                {$odinfo["packageinfo"]['ptitle']}
                {volist name="odinfo['houseinfo']" id="odinfo1" key="i"}
                <li><span class="left">

                    <i id="tnum">{$odinfo1['pnum']-$odinfo1['childrennum']}</i>成人

                 {if condition="$odinfo1['childrennum'] neq 0"}
                     + {$odinfo1['childrennum']}儿童
                    {/if}

{if condition="$odinfo1['pnum']+$odinfo1['childrennum'] eq 1"}
                (含单人房差€{$odinfo1['onehouse']})
                {/if}
                </span>


                    <em class="right">+€

                        <i class="tprice">
                            {$odinfo1['totalprice']}
                        </i>

                    </em></li>


                {/volist}
                {if condition="$odinfo['discount'] neq 0"}
                <li><span class="left">折扣</span><i>{$odinfo['discount']}%</i>

                    <em class="right">-€ <i >{$odinfo['baseprice']-$odinfo['payprice']}</i></em>

                </li>
                {/if}

                {/volist}

            </ul>
            <ul class="inlist yhinlist">
                <li><span class="left">自费项目</span><em class="right">€ <i id="selfpaytotal">0</i></em></li>
                <span id="showselfpay">

               </span>
            </ul>

            <ul class="inlist yhinlist">
                <li><span class="left">优惠信息</span>
                    <input type="hidden" id="score" name="score" value="{$supplement_score}"/>
                    <input type="hidden" id="couponprice" name="couponprice" value="{$supplement_coupon}"/>
                    <em class="right">-€ <i id="yh_totalprice">0</i></em></li>
                <li><span class="left">积分</span><em class="right">-€<i id="yh_priec">{$supplement_score}</i></em></li>
                <li><span class="left">优惠券</span><em class="right">- €<i id="yh_dprice">{$supplement_coupon}</i></em></li>
            </ul>

            <div class="pay_r_b">
                <span class="left">合计</span><em class="right">€ <b id="totalprice">{$order['payprice']}</b></em>
            </div>
        </div>
    </div>




</div>
<form name="orderform" id="orderform"  action="/admin/order/order_supplement_edit" method="post">
    <input type="hidden" name="orderid" value="{$orderid}">
    <input type="hidden" name="selfpaylist" id="selfpaylist">
</form>
</div>

<!--底部-->


<script>

    /*JQuery 限制文本框只能输入数字---积分抵扣输入框*/
    $("#userscore").keyup(function(){
        $(this).val($(this).val().replace(/[^\d]/g,''));
        if(($(this).val()*1000)>$(this).attr("thisprice")){
            Math.floor($(this).attr("thisprice")/1000)
            $(this).val(Math.floor($(this).attr("thisprice")/1000))
            $("#scr1").html($(this).val());
            $("#showscore").html($(this).attr("thisprice")-$(this).val()*1000)
            $("#score").val($(this).val());
        }else{
            $("#scr1").html($(this).val());
            $("#showscore").html($(this).attr("thisprice")-$(this).val()*1000)
            $("#score").val($(this).val());
        }

        leftshow();

    }).bind("paste",function(){  //CTR+V事件处理
        $(this).val($(this).val().replace(/[^\d]/g,''));
        if(($(this).val()*1000)>$(this).attr("thisprice")){
            Math.floor($(this).attr("thisprice")/1000)
            $(this).val(Math.floor($(this).attr("thisprice")/1000))
            $("#scr1").html($(this).val());
            $("#showscore").html($(this).attr("thisprice")-$(this).val()*1000)
            $("#score").val($(this).val());
        }else{
            $("#scr1").html($(this).val());
            $("#showscore").html($(this).attr("thisprice")-$(this).val()*1000)
            $("#score").val($(this).val());
        }
        leftshow();
    }).css("ime-mode", "disabled"); //CSS设置输入法不可用


    //








    //优惠卷点击事件





    var sed= [];

    $(document).ready(function(){

        var supplement=$("#supplement").find("p");

        for(var i=0;i<supplement.length;i++){

            var obj=supplement[i];
            var inarray=new Array();
            inarray['id'] = $(obj).attr("thisid");
            inarray['sppid']=$(obj).attr("thissppid");
            inarray['sppackageid']=$(obj).attr("thisspp_packageid");
            inarray['title'] = $(obj).attr("thistitle");
            inarray['uprice'] = $(obj).attr("thisprice");
            inarray['cprice'] = $(obj).attr("thiscprice");
            inarray['unum'] = $(obj).attr("thisnpnum");
            inarray['cnum'] = 0;
            inarray['ctotal'] = $(obj).attr("thisprice") * npnum;
            sed[sed.length]=inarray;

            var nes1 = $("span[thisid=" + inarray['id'] + "]")
            var nes = $("em[thisid=" + inarray['id'] + "]")
            $(nes1).attr("class","active");
            $(nes).attr("class","active");
            $("#up"+$(obj).attr("thisid")).val(inarray['unum']);
        }

        leftshow()
    });






    //单选被点击
    function cselect2(obj) {
        //默认人数
        npnum=1;

        if ($(obj).children("span").attr("class") == "active") {

            for (i = 0; i < sed.length; i++) {
                if (sed[i]['id'] == $(obj).attr("thisid")) {
                    sed.splice(i, 1);
                }
            }
            $(obj).children("span").attr("class", "");
            $("#up" + $(obj).attr("thisid")).val(0);
            leftshow()


        } else {


            var cfno = $(obj).children("span").attr("fno");


            var nes = $("span[fno=" + cfno + "]")

            //遍历同级选项，若有选中则改为选掉,并从数组中删除
            for (i = 0; i < nes.length; i++) {
                for (j = 0; j < sed.length; j++) {
                    if (sed[j]['id'] == $(nes[i]).attr("thisid")) {
                        sed.splice(j, 1);
                        $("#up" + $(nes[i]).attr("thisid")).val(0);
                        $("#cp" + $(nes[i]).attr("thisid")).val(0);
                    }


                }

            }

            $("span[fno=" + cfno + "]").attr("class", "")

            //将新选择项，加入数组
            var inarray=new Array();
            inarray['id'] = $(obj).attr("thisid");
            inarray['sppid']=$(obj).attr("thissppid");
            inarray['sppackageid']=$(obj).attr("thisspp_packageid");
            inarray['title'] = $(obj).attr("thistitle");
            inarray['uprice'] = $(obj).attr("thisprice");
            inarray['cprice'] = $(obj).attr("thiscprice");
            inarray['unum'] = npnum;
            inarray['cnum'] = 0;
            inarray['ctotal'] = $(obj).attr("thisprice") * npnum;
            sed[sed.length]=inarray;
            $("#up" + $(obj).attr("thisid")).val(npnum);
            $(obj).children("span").attr("class", "active");

        }

        leftshow()
    }
    //多选被点击
    function cselect1(obj) {

        //默认数量
        npnum=1;

        if ($(obj).children("em").attr("class") == "active") {

            for(i=0;i<sed.length;i++){
                if(sed[i]['id']==$(obj).attr("thisid")){
                    sed.splice(i,1);
                }
            }
            $(obj).children("em").attr("class","") ;
            $("#up"+$(obj).attr("thisid")).val(0);
            $("#cp"+$(obj).attr("thisid")).val(0);

        } else {

            var inarray=new Array();

            inarray['id']=$(obj).attr("thisid");
            inarray['sppid']=$(obj).attr("thissppid");
            inarray['sppackageid']=$(obj).attr("thisspp_packageid");
            inarray['title']=$(obj).attr("thistitle");
            inarray['uprice']=$(obj).attr("thisprice");
            inarray['cprice']=$(obj).attr("thiscprice");
            inarray['unum']=npnum;
            inarray['cnum']=0;
            inarray['ctotal']=$(obj).attr("thisprice")*npnum;
            sed[sed.length]=inarray;
            $("#up"+$(obj).attr("thisid")).val(npnum);
            $(obj).children("em").attr("class","active");
        }
        leftshow()
    }

    //成人+
    //加号+点击----需要判断单选时，将其他单选选掉

    function upadd(obj){

        //判断多选还是单选

        //单选增加
        if($(obj).attr("thistype")==2){
            //判断新增还是修改
            var nes = $("span[thisid=" + $(obj).attr("thisid") + "]")
            if($(nes).attr("class")=="active"){
                var upnum=parseInt($("#up"+$(obj).attr("thisid")).val())+1;
                $("#up"+$(obj).attr("thisid")).val(upnum);
                for(i=0;i<sed.length;i++){
                    if(sed[i]["id"]==$(obj).attr("thisid")){

                        sed[i]['unum']=upnum;
                        sed[i]['ctotal']=sed[i]['uprice']*upnum+sed[i]['cprice']*sed[i]['cnum'];
                        break;
                    }
                }

                leftshow()
            }else{
                //找到元素执行新增函数操作
                var nes1 = $("div[thisid=" + $(obj).attr("thisid") + "]")
                cselect2($(nes1))
            }

        }
        //多选增加
        if($(obj).attr("thistype")==1){

            //判断新增还是修改
            var nes = $("em[thisid=" + $(obj).attr("thisid") + "]")
            if($(nes).attr("class")=="active"){
                var upnum=parseInt($("#up"+$(obj).attr("thisid")).val())+1;
                $("#up"+$(obj).attr("thisid")).val(upnum);
                for(i=0;i<sed.length;i++){

                    if(sed[i]["id"]==$(obj).attr("thisid")){
                        sed[i]['unum']=upnum;
                        sed[i]['ctotal']=sed[i]['uprice']*upnum+sed[i]['cprice']*sed[i]['cnum'];
                        break;
                    }
                }
                leftshow()
            }else{
                //找到元素执行新增函数操作
                var nes1 = $("div[thisid=" + $(obj).attr("thisid") + "]")
                cselect1($(nes1))
            }
        }

    }
    //成人-
    //减号-点击
    function upminus(obj){

//首先判断是否为0，若为0则不做任何操作

        if($("#up"+$(obj).attr("thisid")).val()==0||$("#up"+$(obj).attr("thisid")).val()==""){
            return;
        }
//第二判断如果选项为1 并且儿童数量为0或者无儿童数量，则操作取消选项


        if($("#up"+$(obj).attr("thisid")).val()==1&&($("#cp"+$(obj).attr("thisid")).length<=0||$("#cp"+$(obj).attr("thisid")).val()==0)){
            for(i=0;i<sed.length;i++){
                if(sed[i]['id']==$(obj).attr("thisid")){
                    sed.splice(i,1);
                }
            }
            var nes = $("em[thisid=" + $(obj).attr("thisid") + "]")
            var nes1 = $("span[thisid=" + $(obj).attr("thisid") + "]")
            $(nes).attr("class","") ;
            $(nes1).attr("class","") ;
            $("#up"+$(obj).attr("thisid")).val(0);
            leftshow()
            return;
        }


        var upnum=parseInt($("#up"+$(obj).attr("thisid")).val())-1;

        $("#up"+$(obj).attr("thisid")).val(upnum);
        for(i=0;i<sed.length;i++){
            if(sed[i]["id"]==$(obj).attr("thisid")){
                sed[i]['unum']=upnum;
                sed[i]['ctotal']=sed[i]['uprice']*sed[i]['unum']+sed[i]['cprice']*sed[i]['cnum'];
                break;
            }
        }
        leftshow()


    }



    //儿童+
    //加号+点击----需要判断单选时，将其他单选选掉
    /**
     function cpadd(obj){

        //判断多选还是单选

        //单选增加
        if($(obj).attr("thistype")==1){
            //判断新增还是修改

            var nes = $("span[thisid=" + $(obj).attr("thisid") + "]")


            if($(nes).attr("class")=="active"){

                var cpnum=parseInt($("#cp"+$(obj).attr("thisid")).val())+1;

                $("#cp"+$(obj).attr("thisid")).val(cpnum);
                for(i=0;i<sed.length;i++){
                    if(sed[i]["id"]==$(obj).attr("thisid")){
                        sed[i]['cnum']=cpnum;
                        sed[i]['ctotal']=sed[i]['uprice']*sed[i]['unum']+sed[i]['cprice']*sed[i]['cnum'];
                        break;
                    }
                }
                leftshow()
            }else{
                //找到元素执行新增函数操作
                var nes1 = $("div[thisid=" + $(obj).attr("thisid") + "]")
                cselect1($(nes1))
                //默认增加的是成人数量，这里需要修改为儿童数量
                for(i=0;i<sed.length;i++){
                    if(sed[i]["id"]==$(obj).attr("thisid")){
                        sed[i]['cnum']=sed[i]['unum'];
                        sed[i]['unum']=0;
                        sed[i]['ctotal']=sed[i]['cnum']*sed[i]['cprice'];
                        break;
                    }
                }
                $("#cp"+$(obj).attr("thisid")).val($("#npnum").val());
                $("#up"+$(obj).attr("thisid")).val(0);


                leftshow()


            }

        }
        //多选增加
        if($(obj).attr("thistype")==2){

            //判断新增还是修改
            var nes = $("em[thisid=" + $(obj).attr("thisid") + "]")
            if($(nes).attr("class")=="active"){
                var cpnum=parseInt($("#cp"+$(obj).attr("thisid")).val())+1;
                $("#cp"+$(obj).attr("thisid")).val(cpnum);
                for(i=0;i<sed.length;i++){
                    alert(sed[i]["id"]);
                    alert($(obj).attr("thisid"));
                    if(sed[i]["id"]==$(obj).attr("thisid")){
                        sed[i]['cnum']=cpnum;
                        sed[i]['ctotal']=sed[i]['uprice']*sed[i]['unum']+sed[i]['cprice']*sed[i]['cnum'];
                        break;
                    }
                }
                leftshow()
            }else{
                //找到元素执行新增函数操作
                var nes1 = $("div[thisid=" + $(obj).attr("thisid") + "]")
                cselect2($(nes1))
                //默认增加的是成人数量，这里需要修改为儿童数量
                for(i=0;i<sed.length;i++){
                    if(sed[i]["id"]==$(obj).attr("thisid")){
                        sed[i]['cnum']=sed[i]['unum'];
                        sed[i]['unum']=0;
                        sed[i]['ctotal']=sed[i]['cnum']*sed[i]['cprice'];
                        break;
                    }
                }
                $("#cp"+$(obj).attr("thisid")).val($("#npnum").val());
                $("#up"+$(obj).attr("thisid")).val(0);


                leftshow()
            }
        }




    }



     //儿童-
     //减号-点击
     function cpminus(obj){

//首先判断是否为0，若为0则不做任何操作
        if($("#cp"+$(obj).attr("thisid")).val()==0||$("#cp"+$(obj).attr("thisid")).val()==""){
            return;
        }
//第二判断如果选项为1 并且儿童数量为0或者无儿童数量，则操作取消选项


        if($("#cp"+$(obj).attr("thisid")).val()==1&&($("#up"+$(obj).attr("thisid")).length<=0||$("#up"+$(obj).attr("thisid")).val()==0)){
            for(i=0;i<sed.length;i++){
                if(sed[i]['id']==$(obj).attr("thisid")){
                    sed.splice(i,1);
                }
            }

            var nes = $("em[thisid=" + $(obj).attr("thisid") + "]")
            var nes1 = $("span[thisid=" + $(obj).attr("thisid") + "]")
            $(nes).attr("class","") ;
            $(nes1).attr("class","") ;
            $("#cp"+$(obj).attr("thisid")).val(0);
            leftshow()
            return;
        }

        var cpnum=parseInt($("#cp"+$(obj).attr("thisid")).val())-1;

        $("#cp"+$(obj).attr("thisid")).val(cpnum);
        for(i=0;i<sed.length;i++){
            if(sed[i]["id"]==$(obj).attr("thisid")){
                sed[i]['cnum']=cpnum;
                sed[i]['ctotal']=sed[i]['uprice']*sed[i]['unum']+sed[i]['cprice']*sed[i]['cnum'];
                break;
            }
        }
        leftshow()

    }

     **/




    function leftshow(){
        console.log(sed);


        var outputhtml="";
        var total=0;
        for(var i=0;i<sed.length;i++){
            var cpr="";
            if(sed[i]['cprice']!=0){
                cpr="儿童 "+sed[i]['cprice']+"×"+sed[i]['cnum'];
            }
            var out1="<li><span class='left'>"+sed[i]['title']+"</span></li><li>数量:" +sed[i]['unum']+
                "×€"+sed[i]['uprice']+"<span class='right' style='color: #999999'>+€<i id='y_priec'>"+sed[i]['unum']*sed[i]['uprice']+"</i></span></li>"
            sed[i]['ctotal']=sed[i]['unum']*sed[i]['uprice']
            outputhtml=out1+outputhtml;
            total=sed[i]['ctotal']+total;
        }
        $("#showselfpay").html(outputhtml);
        $("#selfpaytotal").html(total);

        //计算同业应扣除佣金金额
        var commprice=0;
        var spcommprice=0

        if($("#isty").val()==1){
            //获取佣金比例
            var  comm=$("#commission").val()

            //折扣后总额+自费项目总额
            var total1=  parseInt($("#jbtf").html())+parseInt(total)
            //需要扣除的佣金
            // alert(total1);
            commprice=parseInt(total1*parseFloat(comm));
            $("#tyyj").html(commprice);
            $("#tyyj_span").html(commprice);

            //计算自费项目需要扣除的佣金----因为总金额里已经扣除了基础团费的佣金

            spcommprice=Math.round(parseInt(total)*parseFloat(comm));
        }

        // $("#zfhj").html(total);


        //自费项目总额
        $("#mselfpay").val(total-spcommprice)
        var sfinfolist="";
        for(var i=0;i<sed.length;i++){
            var str1="";
            var prospid=sed[i]['id'];
            var sppid=sed[i]['sppid'];
            var sppackageid=sed[i]['sppackageid'];
            var stitle=sed[i]['title'];
            var uprice=sed[i]['uprice'];
            var unum=sed[i]['unum'];
            var cnum=0;
            var cprice=0;
            if(sed[i].hasOwnProperty("cnum")&&sed[i]['cnum']!=0){
                cprice=sed[i]['cprice']
                cnum=sed[i]['cnum']
            };
            var pricetotal=unum*uprice+cnum*cprice;
            var s_num=parseInt(unum)+parseInt(cnum);
            str1=prospid+"|"+sppid+"|"+sppackageid+"|"+stitle+"|"+uprice+"|"+unum+"|"+s_num+"|"+pricetotal+"|"+cnum+"|"+cprice;

// 0产品自费项目id|1自由行产品id|2自由行产品套餐id|3显示标题|4单价|5数量|6总数量|7总价|8儿童数量|9儿童单价

            if(sfinfolist==""){
                sfinfolist=str1
            }else{
                sfinfolist=str1+"*"+sfinfolist
            }
        }
//alert(sfinfolist);
        $("#selfpaylist").val(sfinfolist);

        //用户需要抵扣的积分金额
        var userscore=0;
        if($("#score").val()!=""){
            userscore= $("#score").val();
        }
        $("#yh_priec").html(userscore)

        //用户需要 抵扣的优惠卷金额
        var couponprice=0;
        if($("#couponprice").val()!=""){
            couponprice= $("#couponprice").val();
        }
        $("#yh_dprice").html(couponprice);

        $("#yh_totalprice").html(parseInt(userscore)+parseInt(couponprice));




        //页面显示价格

    $("#totalprice").html(parseInt($("#t_totlaprice").html())+parseInt($("#selfpaytotal").html())-userscore-couponprice);
    $("#tatol_b").html(parseInt($("#t_totlaprice").html())+parseInt($("#selfpaytotal").html())-userscore-couponprice);



    }
    $("#surelist").click(function(){
        if($(this).is(':checked')==false){
           // $('.no_great').show();
        }else{
           // $('.no_great').hide();
        }
    })





    //提交订单
    $("#pay_btn").click(function(){


        $("#orderform").submit();

    })

    //提交订单
    $(".pay_btn1").click(function(){

        var regThreeA=/^[a-zA-Z]{3}$/;//三个字母
        //var regfiftyA=/^[a-zA-Z]{1,15}$/;
        var regfiftyA=/^[a-zA-Z]+(\s+[a-zA-Z]+)*$/;
        var null_reg = /\s+/g;//非空正则
        var email_reg=/\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/;//邮箱正则
        var tel_myreg = /^[1][3,4,5,7,8][0-9]{9}$/;//手机号

        /*联系人姓名*/
        var lxr = $("input[name='c_name']");

        var lxr_val = lxr.val();
        if (lxr_val.replace(null_reg,"")==""){
            layer.msg('请填写联系人！', {icon: 5});
            $('html, body').animate({ scrollTop: parseInt(lxr.offset().top)-60 }, 500);
            lxr.css({"border":"1px solid red"});
            return false;
        }else{
            lxr.css('border-color', '#ddd');
        }


        /*联系人电话*/
        var tel = $("input[name='c_tel']");
        var tel_val = tel.val();
        if (!tel_myreg.test(tel_val)){
            layer.msg('请填写正确的电话号码！', {icon: 5});
            $('html, body').animate({ scrollTop: parseInt(tel.offset().top)-60 }, 500);
            tel.css({"border":"1px solid red"});
            return false;
        }else{
            tel.css('border-color', '#ddd');
        }

        /*联系人邮箱*/
        var em = $("input[name='c_email']").val();
        if (!email_reg.test(em)){
            layer.msg('请填写正确的邮箱！', {icon: 5});
            $('html, body').animate({ scrollTop: parseInt($("input[name='c_email']").offset().top)-60 }, 500);
            $("input[name='c_email']").css({"border":"1px solid red"});
            return false;
        }else{
            $("input[name='c_email']").css('border-color', '#ddd');
        }

        /*联系人发票地址*/
        var add = $("input[name='c_address']");
        var add_val = add.val();
        if (add_val.replace(null_reg,"")==""){
            layer.msg('请填写联系地址！', {icon: 5});
            $('html, body').animate({ scrollTop: parseInt(add.offset().top)-60 }, 500);
            add.css({"border":"1px solid red"});
            return false;
        }else{
            add.css('border-color', '#ddd');
        }

        /*联系人备注*/
        var ydbak = $("textarea[name='Remark']");
        var ydbak_val = ydbak.val();

        /*收集游客信息*/
        var morep = new Object();

        /*中文名*/
        var fn = new Array();
        var isfn =1;
        $("input[name='u_name']").each(function(i){
            var classObj_fn = $("input[name='u_name']").eq(i);
            fn[i] = $(this).val();
            if (fn[i].replace(null_reg,"")==""){
                layer.msg('请填写游客姓名！', {icon: 5});
                isfn = 0;
                $('html, body').animate({ scrollTop: parseInt(classObj_fn.offset().top)-60 }, 500);
                classObj_fn.css({"border":"1px solid red"});
                return false;
            }else{
                classObj_fn.css('border-color', '#ddd');
            }
        })
        if(isfn == 0){
            return false;
        }
        morep.fn =fn;

        /*拼音/英文姓*/
        var tn = new Array();
        var istn =1;
        $("input[name='firstname']").each(function(i){
            var classObj_tn = $("input[name='firstname']").eq(i);
            tn[i] = $(this).val();
            /*if (tn[i].replace(null_reg,"")==""){*/
            if(!regfiftyA.test(tn[i])){
                layer.msg('请填写游客拼音/英文姓，必须是字母！', {icon: 5});
                istn = 0;
                $('html, body').animate({ scrollTop: parseInt(classObj_tn.offset().top)-60 }, 500);
                classObj_tn.css({"border":"1px solid red"});
                return false;
            }else{
                classObj_tn.css('border-color', '#ddd');
            }
        })
        if(istn == 0){
            return false;
        }
        morep.tn =tn;

        /*拼音/英文名*/
        var ln = new Array();
        var isln =1;
        $("input[name='lastname']").each(function(i){
            var classObj_ln = $("input[name='lastname']").eq(i);
            ln[i] = $(this).val();
            /*if (ln[i].replace(null_reg,"")==""){*/
            if(!regfiftyA.test(ln[i])){
                layer.msg('请填写游客拼音/英文名，必须是字母！', {icon: 5});
                isln = 0;
                $('html, body').animate({ scrollTop: parseInt(classObj_ln.offset().top)-60 }, 500);
                classObj_ln.css({"border":"1px solid red"});
                return false;
            }else{
                classObj_ln.css('border-color', '#ddd');
            }
        })
        if(isln == 0){
            return false;
        }
        morep.ln =ln;

        /*游客护照号码*/
        var hzhm = new Array();
        var ishz =1;
        $("input[name='passport']").each(function(i){
            var classObj_hzhm = $("input[name='passport']").eq(i);
            hzhm[i] = $(this).val();
            if (hzhm[i].replace(null_reg,"")==""){
                layer.msg('请填写护照号码！', {icon: 5});
                ishz = 0;
                $('html, body').animate({ scrollTop: parseInt(classObj_hzhm.offset().top)-60 }, 500);
                classObj_hzhm.css({"border":"1px solid red"});
                return false;
            }else{
                classObj_hzhm.css('border-color', '#ddd');
            }
        })
        if(ishz == 0){
            return false;
        }
        morep.hzhm =hzhm;

        //性别
        var ysex = new Array();
        $("select[name='u_gender']").each(function(i){
            ysex[i] =  $(this).find("option:selected").val();

        })
        morep.ysex =ysex;
        //alert(ysex);

        //国籍
        var hzlx = new Array();
        $("select[name='country']").each(function(i){
            hzlx[i] =  $(this).find("option:selected").val();
        })
        morep.hzlx =hzlx;
        //alert(hzlx);

        /*证件有效期*/
        var zjnum = new Array();
        var isnum =1;
        $("input[name='no_date']").each(function(i){
            var classObj_hzhm = $("input[name='no_date']").eq(i);
            zjnum[i] = $(this).val();
            if (zjnum[i].replace(null_reg,"")==""){
                layer.msg('请选择日期！', {icon: 5});
                isnum = 0;
                $('html, body').animate({ scrollTop: parseInt(classObj_hzhm.offset().top)-60 }, 500);
                classObj_hzhm.css({"border":"1px solid red"});
                return false;
            }else{
                classObj_hzhm.css('border-color', '#ddd');
            }
        })
        if(isnum == 0){
            return false;
        }
        morep.zjnum =zjnum;

        /*出生日期*/
        var birdate = new Array();
        var isbir =1;
        $("input[name='birthday_date']").each(function(i){
            var classObj_hzhm = $("input[name='birthday_date']").eq(i);
            birdate[i] = $(this).val();
            if (birdate[i].replace(null_reg,"")==""){
                layer.msg('请选择日期！', {icon: 5});
                isbir = 0;
                $('html, body').animate({ scrollTop: parseInt(classObj_hzhm.offset().top)-60 }, 500);
                classObj_hzhm.css({"border":"1px solid red"});
                return false;
            }else{
                classObj_hzhm.css('border-color', '#ddd');
            }
        })
        if(isbir == 0){
            return false;
        }
        morep.birdate =birdate;

        /*游客区号*/
        var qu_num = new Array();
        var isqu_num =1;
        $("input[name='u_qunum']").each(function(i){
            var classObj_hzhm = $("input[name='u_qunum']").eq(i);
            qu_num[i] = $(this).val();
            if (birdate[i].replace(null_reg,"")==""){
                layer.msg('请填写区号！', {icon: 5});
                isqu_num = 0;
                $('html, body').animate({ scrollTop: parseInt(classObj_hzhm.offset().top)-60 }, 500);
                classObj_hzhm.css({"border":"1px solid red"});
                return false;
            }else{
                classObj_hzhm.css('border-color', '#ddd');
            }
        })
        if(isqu_num == 0){
            return false;
        }
        morep.qu_num =qu_num;

        /*游客电话*/
        var tel_num = new Array();
        var istel_num =1;
        $("input[name='u_tel']").each(function(i){
            var classObj_hzhm = $("input[name='u_tel']").eq(i);
            tel_num[i] = $(this).val();
            if (!tel_myreg.test(tel_num[i])){
                layer.msg('请填写手机号码！', {icon: 5});
                istel_num = 0;
                $('html, body').animate({ scrollTop: parseInt(classObj_hzhm.offset().top)-60 }, 500);
                classObj_hzhm.css({"border":"1px solid red"});
                return false;
            }else{
                classObj_hzhm.css('border-color', '#ddd');
            }
        })
        if(istel_num == 0){
            return false;
        }
        morep.tel_num =tel_num;

        var json_people = JSON.stringify(morep);
        //alert(json_people);

    })













</script>